
/*  Scrollbar - a jQuery plugin for custom scrollbars */

(function ($, document) {

    $.fn.scrollbar = function (opts) {

        // Extend default options
        var options = $.extend({}, $.fn.scrollbar.defaults, opts);


        //
        // append scrollbar to selected overflowed containers and return jquery object for chainability
        //
        return this.each(function () {

            var container = $(this),
                props = {
                    arrows: options.arrows
                };

            // set new container height if explicitly set by an option
            if (options.containerHeight) {
                container.height(options.containerHeight);
            }

            // determine container height
            props.containerHeight = container.height();

            // determine inner content height
            props.contentHeight = 0;
            container.children().each(function () {
                props.contentHeight += $(this).outerHeight();
            });

            // do nothing and return if a scrollbar is not neccessary
            if (props.contentHeight <= props.containerHeight) {
                return true;
            }

            // create scrollbar
            var scrollbar = new $.fn.scrollbar.Scrollbar(container, props, options);
            return scrollbar;
        });
    };



    //
    // default options
    //
    $.fn.scrollbar.defaults = {
        containerHeight: null,       // height of content container. If set to null, the current height before DOM manipulation is used

        arrows: true,       // render up- and down-arrows
        handleMinHeight: 50,         // min-height of handle [px]

        scrollSpeed: 5,         // speed of handle while mousedown on arrows [milli sec]
        scrollStep: 3,         // handle increment between two mousedowns on arrows [px]

        scrollSpeedArrows: 5,         // speed of handle while mousedown within the handle container [milli sec]
        scrollStepArrows: 3           // handle increment between two mousedowns within the handle container [px]
    };



    //
    // Scrollbar class properties
    //
    $.fn.scrollbar.Scrollbar = function (container, props, options) {

        // set object properties
        this.container = container;
        this.props = props;
        this.opts = options;
        this.mouse = {};

        // disable arrows via class attribute 'no-arrows' on a container
        this.props.arrows = this.container.hasClass('no-arrows') ? false : this.props.arrows;

        // initialize
        this.buildHtml();
        this.initHandle();
        this.appendEvents();
    };

    //
    // Scrollbar class methods
    //
    $.fn.scrollbar.Scrollbar.prototype = {

        //
        // build DOM nodes for pane and scroll-handle
        //
        //   from:
        //
        //      <div class="scrollbar">                             --> arbitrary element with class="scrollbar"
        //          [...]
        //      </div>
        //
        //   to:
        //
        //      <div class="scrollbar">                             --> this.container
        //          <div class="scrollbar-pane">                    --> this.pane
        //              [...]
        //          </div>
        //          <div class="scrollbar-handle-container">        --> this.handleContainer
        //              <div class="scrollbar-handle"></div>        --> this.handle
        //          </div>
        //          <div class="scrollbar-handle-up"></div>         --> this.handleArrows
        //          <div class="scrollbar-handle-down"></div>       --> this.handleArrows
        //      </div>
        //
        //
        // TODO: use detach-transform-attach or DOMfragment
        //
        buildHtml: function () {

            // build some DOM nodes
            this.container.children().wrapAll('<div class="scrollbar-pane"/>');
            this.container.append('<div class="scrollbar-handle-container"><div class="scrollbar-handle"/></div>');
            if (this.props.arrows) {
                this.container.append('<div class="scrollbar-handle-up"/>').append('<div class="scrollbar-handle-down"/>');
            }

            // save height of container to re-set it after some DOM manipulations
            var height = this.container.height();

            // set scrollbar-object properties
            this.pane = this.container.find('.scrollbar-pane');
            this.handle = this.container.find('.scrollbar-handle');
            this.handleContainer = this.container.find('.scrollbar-handle-container');
            this.handleArrows = this.container.find('.scrollbar-handle-up, .scrollbar-handle-down');
            this.handleArrowUp = this.container.find('.scrollbar-handle-up');
            this.handleArrowDown = this.container.find('.scrollbar-handle-down');

            // set some default CSS attributes (may be overwritten by CSS definitions)
            this.pane.defaultCss({
                'top': 0,
                'left': 0
            });
            this.handleContainer.defaultCss({
                'right': 0
            });
            this.handle.defaultCss({
                'top': 0,
                'right': 0
            });
            this.handleArrows.defaultCss({
                'right': 0
            });
            this.handleArrowUp.defaultCss({
                'top': 0
            });
            this.handleArrowDown.defaultCss({
                'bottom': 0
            });

            // set some necessary CSS attributes (can NOT be overwritten by CSS definitions)
            this.container.css({
                'position': this.container.css('position') === 'absolute' ? 'absolute' : 'relative',
                'overflow': 'hidden',
                'height': height
            });
            this.pane.css({
                'position': 'absolute',
                'overflow': 'visible',
                'height': 'auto'
            });
            this.handleContainer.css({
                'position': 'absolute',
                'top': this.handleArrowUp.outerHeight(true),
                'height': (this.props.containerHeight - this.handleArrowUp.outerHeight(true) - this.handleArrowDown.outerHeight(true)) + 'px'
            });
            this.handle.css({
                'position': 'absolute',
                'cursor': 'pointer'
            });
            this.handleArrows.css({
                'position': 'absolute',
                'cursor': 'pointer'
            });
        },


        //
        // append events on handle and handle-container
        //
        appendEvents: function () {

            // append drag-drop event on scrollbar-handle
            this.handle.bind('mousedown.handle', $.proxy(this, 'startOfHandleMove'));

            // append mousedown event on handle-container
            this.handleContainer.bind('mousedown.handle', $.proxy(this, 'onHandleContainerMousedown'));

            // append hover event on handle-container
            this.handleContainer.bind('mouseenter.container mouseleave.container', $.proxy(this, 'onHandleContainerHover'));

            // append click event on scrollbar-up- and scrollbar-down-handles
            this.handleArrows.bind('mousedown.arrows', $.proxy(this, 'onArrowsMousedown'));

            // append mousewheel event on content container
            this.container.bind('mousewheel.container', $.proxy(this, 'onMouseWheel'));

            // append hover event on content container
            this.container.bind('mouseenter.container mouseleave.container', $.proxy(this, 'onContentHover'));

            // do not bubble down click events into content container
            this.handle.bind('click.scrollbar', this.preventClickBubbling);
            this.handleContainer.bind('click.scrollbar', this.preventClickBubbling);
            this.handleArrows.bind('click.scrollbar', this.preventClickBubbling);
        },


        //
        // calculate height of handle (height of handle should indicate height of content related to content-container).
        //
        initHandle: function () {
            this.props.handleContainerHeight = this.handleContainer.height();

            // we need to calculate content-height again: due to the added scrollbar, the width decreased - hence the height increased!
            var contentHeight = 0;
            this.pane.children().each(function () {
                contentHeight += $(this).outerHeight(true);
            });
            this.props.contentHeight = contentHeight;

            // set height of handle proportionally
            this.props.handleHeight = Math.max(this.props.containerHeight * this.props.handleContainerHeight / this.props.contentHeight, this.opts.handleMinHeight);

            this.handle.height(this.props.handleHeight);
            this.handle.height(2 * this.handle.height() - this.handle.outerHeight(true));  // this is sort of setting outerHeight

            // set min- and max-range for handle
            this.props.handleTop = {
                min: 0,
                max: this.props.handleContainerHeight - this.props.handleHeight
            };

            // set ratio of handle-container to content-container (to calculate position of content related to position of handle)
            this.props.handleContentRatio = (this.props.contentHeight - this.props.containerHeight) / (this.props.handleContainerHeight - this.props.handleHeight);

            // set initial position of handle at top
            this.handle.top = 0;
        },


        //
        // get mouse position helper
        //
        mousePosition: function (ev) {
            return ev.pageY || (ev.clientY + (document.documentElement.scrollTop || document.body.scrollTop)) || 0;
        },



        // ---------- event handler ---------------------------------------------------------------

        //
        // start moving of handle
        //
        startOfHandleMove: function (ev) {
            ev.preventDefault();
            ev.stopPropagation();

            // set start position of mouse
            this.mouse.start = this.mousePosition(ev);

            // set start position of handle
            this.handle.start = this.handle.top;

            // bind mousemove- and mouseout-event on document (binding it to document allows having a mousepointer outside handle while moving)
            $(document).bind('mousemove.handle', $.proxy(this, 'onHandleMove')).bind('mouseup.handle', $.proxy(this, 'endOfHandleMove'));

            // add class for visual change while moving handle
            this.handle.addClass('move');
            this.handleContainer.addClass('move');
        },


        //
        // on moving of handle
        //
        onHandleMove: function (ev) {
            ev.preventDefault();

            // calculate distance since last fireing of this handler
            var distance = this.mousePosition(ev) - this.mouse.start;

            // calculate new handle position
            this.handle.top = this.handle.start + distance;

            // update positions
            this.setHandlePosition();
            this.setContentPosition();
        },


        //
        // end moving of handle
        //
        endOfHandleMove: function (ev) {

            // remove handle events (which were attached in the startOfHandleMove-method)
            $(document).unbind('.handle');

            // remove class for visual change 
            this.handle.removeClass('move');
            this.handleContainer.removeClass('move');
        },


        //
        // set position of handle
        //
        setHandlePosition: function () {

            // stay within range [handleTop.min, handleTop.max]
            this.handle.top = (this.handle.top > this.props.handleTop.max) ? this.props.handleTop.max : this.handle.top;
            this.handle.top = (this.handle.top < this.props.handleTop.min) ? this.props.handleTop.min : this.handle.top;

            this.handle[0].style.top = this.handle.top + 'px';
        },


        //
        // set position of content
        //
        setContentPosition: function () {

            // derive position of content from position of handle 
            this.pane.top = -1 * this.props.handleContentRatio * this.handle.top;

            this.pane[0].style.top = this.pane.top + 'px';
        },


        //
        // mouse wheel movement
        //
        onMouseWheel: function (ev, delta) {
            delta = delta * 5;
            // calculate new handle position
            this.handle.top -= delta;

            this.setHandlePosition();
            this.setContentPosition();

            // prevent default scrolling of the entire document if handle is within [min, max]-range
            if (this.handle.top > this.props.handleTop.min && this.handle.top < this.props.handleTop.max) {
                ev.preventDefault();
            }
        },


        //
        // append click handler on handle-container (outside of handle itself) to click up and down the handle 
        //
        onHandleContainerMousedown: function (ev) {
            ev.preventDefault();

            // do nothing if clicked on handle
            if (!$(ev.target).hasClass('scrollbar-handle-container')) {
                return false;
            }

            // determine direction for handle movement (clicked above or below the handler?)
            this.handle.direction = (this.handle.offset().top < this.mousePosition(ev)) ? 1 : -1;

            // set incremental step of handle
            this.handle.step = this.opts.scrollStep;

            // stop handle movement on mouseup
            var that = this;
            $(document).bind('mouseup.handlecontainer', function () {
                clearInterval(timer);
                that.handle.unbind('mouseenter.handlecontainer');
                $(document).unbind('mouseup.handlecontainer');
            });

            // stop handle movement when mouse is over handle
            //
            // TODO: this event is fired by Firefox only. Damn!
            //       Right now, I do not know any workaround for this. Mayby I should solve this by collision-calculation of mousepointer and handle
            this.handle.bind('mouseenter.handlecontainer', function () {
                clearInterval(timer);
            });

            // repeat handle movement while mousedown
            var timer = setInterval($.proxy(this.moveHandle, this), this.opts.scrollSpeed);
        },


        //
        // append mousedown handler on handle-arrows
        //
        onArrowsMousedown: function (ev) {
            ev.preventDefault();

            // determine direction for handle movement
            this.handle.direction = $(ev.target).hasClass('scrollbar-handle-up') ? -1 : 1;

            // set incremental step of handle
            this.handle.step = this.opts.scrollStepArrows;

            // add class for visual change while moving handle
            $(ev.target).addClass('move');

            // repeat handle movement while mousedown
            var timer = setInterval($.proxy(this.moveHandle, this), this.opts.scrollSpeedArrows);

            // stop handle movement on mouseup
            $(document).one('mouseup.arrows', function () {
                clearInterval(timer);
                $(ev.target).removeClass('move');
            });
        },


        //
        // move handle by a distinct step while click on arrows or handle-container 
        //
        moveHandle: function () {
            this.handle.top = (this.handle.direction === 1) ? Math.min(this.handle.top + this.handle.step, this.props.handleTop.max) : Math.max(this.handle.top - this.handle.step, this.props.handleTop.min);
            this.handle[0].style.top = this.handle.top + 'px';

            this.setContentPosition();
        },


        //
        // add class attribute on content while interacting with content
        //
        onContentHover: function (ev) {
            if (ev.type === 'mouseenter') {
                this.container.addClass('hover');
                this.handleContainer.addClass('hover');
            } else {
                this.container.removeClass('hover');
                this.handleContainer.removeClass('hover');
            }
        },


        //
        // add class attribute on handle-container while hovering it
        //
        onHandleContainerHover: function (ev) {
            if (ev.type === 'mouseenter') {
                this.handleArrows.addClass('hover');
            } else {
                this.handleArrows.removeClass('hover');
            }
        },


        //
        // do not bubble down to avoid triggering click events attached within the container
        //
        preventClickBubbling: function (ev) {
            ev.stopPropagation();
        }
    };



    // ----- default css ---------------------------------------------------------------------

    $.fn.defaultCss = function (styles) {

        // 'not-defined'-values
        var notdef = {
            'right': 'auto',
            'left': 'auto',
            'top': 'auto',
            'bottom': 'auto',
            'position': 'static'
        };

        // loop through all style definitions and check for a definition already set by css. 
        // if no definition is found, apply the default css definition
        return this.each(function () {
            var elem = $(this);
            for (var style in styles) {
                if (elem.css(style) === notdef[style]) {
                    elem.css(style, styles[style]);
                }
            }
        });
    };

    //
    // ----- mousewheel event ---------------------------------------------------------------------
    // based on jquery.mousewheel.js from Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
    //

    $.event.special.mousewheel = {

        setup: function () {
            if (this.addEventListener) {
                this.addEventListener('mousewheel', $.fn.scrollbar.mouseWheelHandler, false);
                this.addEventListener('DOMMouseScroll', $.fn.scrollbar.mouseWheelHandler, false);
            } else {
                this.onmousewheel = $.fn.scrollbar.mouseWheelHandler;
            }
        },

        teardown: function () {
            if (this.removeEventListener) {
                this.removeEventListener('mousewheel', $.fn.scrollbar.mouseWheelHandler, false);
                this.removeEventListener('DOMMouseScroll', $.fn.scrollbar.mouseWheelHandler, false);
            } else {
                this.onmousewheel = null;
            }
        }
    };


    $.fn.extend({
        mousewheel: function (fn) {
            return fn ? this.bind("mousewheel", fn) : this.trigger("mousewheel");
        },

        unmousewheel: function (fn) {
            return this.unbind("mousewheel", fn);
        }
    });


    $.fn.scrollbar.mouseWheelHandler = function (event) {
        var orgEvent = event || window.event,
            args = [].slice.call(arguments, 1),
            delta = 0,
            returnValue = true,
            deltaX = 0,
            deltaY = 0;

        event = $.event.fix(orgEvent);
        event.type = "mousewheel";

        // Old school scrollwheel delta
        if (event.wheelDelta) {
            delta = event.wheelDelta / 120;
        }
        if (event.detail) {
            delta = -event.detail / 3;
        }

        // Gecko
        if (orgEvent.axis !== undefined && orgEvent.axis === orgEvent.HORIZONTAL_AXIS) {
            deltaY = 0;
            deltaX = -1 * delta;
        }

        // Webkit
        if (orgEvent.wheelDeltaY !== undefined) {
            deltaY = orgEvent.wheelDeltaY / 120;
        }
        if (orgEvent.wheelDeltaX !== undefined) {
            deltaX = -1 * orgEvent.wheelDeltaX / 120;
        }

        // Add event and delta to the front of the arguments
        args.unshift(event, delta, deltaX, deltaY);

        return $.event.handle.apply(this, args);
    };
})(jQuery, document);   // inject global jQuery object

/*	
*	jQuery carouFredSel 2.4.1
*	Demo's and documentation:
*	caroufredsel.frebsite.nl
*	
*	Copyright (c) 2010 Fred Heusschen
*	www.frebsite.nl
*
*	Licensed under the MIT license.
*	http://www.opensource.org/licenses/mit-license.php
*/

eval(function (p, a, c, k, e, r) { e = function (c) { return (c < a ? '' : e(parseInt(c / a))) + ((c = c % a) > 35 ? String.fromCharCode(c + 29) : c.toString(36)) }; if (!''.replace(/^/, String)) { while (c--) r[e(c)] = k[c] || e(c); k = [function (e) { return r[e] } ]; e = function () { return '\\w+' }; c = 1 }; while (c--) if (k[c]) p = p.replace(new RegExp('\\b' + e(c) + '\\b', 'g'), k[c]); return p } ('(q($){$.Y.T=q(o){8(C.U>1){s C.1x(q(){$(C).T(o)})}C.26=q(o){7=$.1y(F,{},$.Y.T.2n,o);7.D=2o(7.D);13=(7.13==\'2p\'||7.13==\'17\')?\'x\':\'y\';8(7.13==\'2q\'||7.13==\'17\'){7.v=[\'1l\',\'27\',\'1m\',\'28\',\'17\',\'1K\',\'2Q\']}G{7.v=[\'1m\',\'28\',\'1l\',\'27\',\'1K\',\'17\',\'2R\'];7.D=[7.D[3],7.D[2],7.D[1],7.D[0]]}8(9(7.j)!=\'14\')7.j={B:7.j};8(!7.j.1l)7.j.1l=w(i).27(F);8(!7.j.1m)7.j.1m=w(i).28(F);8(9(7.j.1L)!=\'K\')7.j.1L=0;8(9(7.j.1z)!=\'K\')7.j.1z=7.j.B;8(9(7.R.j)!=\'K\')7.R.j=7.j.B;7.z=1A(7.z,L,F);7.y=1A(7.y);7.x=1A(7.x);7.M=1A(7.M,F);7.z=$.1y({},7.R,7.z);7.y=$.1y({},7.R,7.y);7.x=$.1y({},7.R,7.x);7.M=$.1y({},7.R,7.M);8(9(7.R.O)!=\'K\')7.R.O=$.Y.T.29;8(9(7.M.2a)!=\'q\')7.M.2a=$.Y.T.2r;8(9(7.M.1M)!=\'V\')7.M.1M=L;8(9(7.z.N)!=\'V\')7.z.N=F;8(9(7.z.1B)!=\'V\')7.z.1B=F;8(9(7.z.2b)!=\'K\')7.z.2b=0;8(9(7.z.1N)!=\'K\')7.z.1N=(7.z.O<10)?2S:7.z.O*5};C.2s=q(){$1n.A({1O:\'2T\',2U:\'2V\'});i.r(\'2t\',{1l:i.A(\'1l\'),1m:i.A(\'1m\'),1O:i.A(\'1O\'),1K:i.A(\'1K\'),17:i.A(\'17\')}).A({1O:\'2W\'});w(i).1x(q(){I m=1C($(C).A(7.v[6]));8(1P(m))m=0;$(C).r(\'Q\',m)});8(7.j.1z>=u){W(\'1f 2c j: 1o 1D\');8(7.y.J)7.y.J.2u();8(7.x.J)7.x.J.2u()}};C.2v=q(){i.15(\'18\',q(){8(1Q!=2w){2X(1Q)}}).15(\'N\',q(e,d,f){i.t(\'18\');8(7.z.N){8(d!=\'y\'&&d!=\'x\')d=13;8(9(f)!=\'K\')f=0;1Q=2Y(q(){8(i.1g(\':1R\'))i.t(\'N\',d);G i.t(d,7.z)},7.z.1N+f)}}).15(\'y\',q(e,b,c){8(i.1g(\':1R\'))s L;8(7.j.1z>=u){W(\'1f 2c j: 1o 1D\');s L}8(9(b)==\'K\')c=b;8(9(b)!=\'14\')b=7.y;8(9(c)!=\'K\')c=b.j;8(9(c)!=\'K\'){W(\'1f a 1S K: 1o 1D\');s L}8(!7.1h){I d=u-E;8(d-c<0){c=d}8(E==0){c=0}}E+=c;8(E>=u)E-=u;8(!7.1h&&!7.1p){8(E==0&&7.y.J)7.y.J.1T(\'1E\');8(7.x.J)7.x.J.2d(\'1E\')}8(c==0){8(7.1p)i.t(\'x\',u-7.j.B);s L}w(i,\':1U(\'+(u-c-1)+\')\').2Z(i);8(u<7.j.B+c)w(i,\':19(\'+((7.j.B+c)-u)+\')\').2x(F).2e(i);I f=2f(i,7,c),1a=w(i,\':1i(\'+(c-1)+\')\'),S=f[1].1b(\':1q\'),Z=f[0].1b(\':1q\');S.A(7.v[6],S.r(\'Q\'));I g=1j(7,w(i,\':19(\'+c+\')\')),1c=1V(1j(7,f[0],F),7);S.A(7.v[6],S.r(\'Q\')+7.D[1]);I h={},2g={},1r={},H=b.O;8(H==\'z\')H=7.R.O/7.R.j*c;G 8(H<10)H=g[0]/H;8(b.1W)b.1W(f[1],f[0],1c,H);h[7.v[4]]=7.D[3];1r[7.v[6]]=1a.r(\'Q\');2g[7.v[6]]=Z.r(\'Q\')+7.D[1];Z.1s().1d(2g,{O:H,P:b.P});1a.A(7.v[6],1a.r(\'Q\')+7.D[3]);1a.1s().1d(1r,{O:H,P:b.P});$1n.1s().1d(1c,{O:H,P:b.P});i.r(\'1t\',c).r(\'1u\',b).r(\'1X\',f[1]).r(\'1Y\',f[0]).r(\'1Z\',1c).A(7.v[4],-g[0]).1d(h,{O:H,P:b.P,2y:q(){8(i.r(\'1u\').20){i.r(\'1u\').20(i.r(\'1X\'),i.r(\'1Y\'),i.r(\'1Z\'))}8(u<7.j.B+i.r(\'1t\')){w(i,\':1U(\'+(u-1)+\')\').1F()}I a=w(i,\':1i(\'+(7.j.B+i.r(\'1t\')-1)+\')\');a.A(7.v[6],a.r(\'Q\'))}});i.t(\'1k\').t(\'N\',[\'\',H])}).15(\'x\',q(e,b,c){8(i.1g(\':1R\'))s L;8(7.j.1z>=u){W(\'1f 2c j: 1o 1D\');s L}8(9(b)==\'K\')c=b;8(9(b)!=\'14\')b=7.x;8(9(c)!=\'K\')c=b.j;8(9(c)!=\'K\'){W(\'1f a 1S K: 1o 1D\');s L}8(!7.1h){8(E==0){8(c>u-7.j.B){c=u-7.j.B}}G{8(E-c<7.j.B){c=E-7.j.B}}}E-=c;8(E<0)E+=u;8(!7.1h&&!7.1p){8(E==7.j.B&&7.x.J)7.x.J.1T(\'1E\');8(7.y.J)7.y.J.2d(\'1E\')}8(c==0){8(7.1p)i.t(\'y\',u-7.j.B);s L}8(u<7.j.B+c)w(i,\':19(\'+((7.j.B+c)-u)+\')\').2x(F).2e(i);I d=2f(i,7,c),1a=w(i,\':1i(\'+(c-1)+\')\'),S=d[0].1b(\':1q\'),Z=d[1].1b(\':1q\');S.A(7.v[6],S.r(\'Q\'));Z.A(7.v[6],Z.r(\'Q\'));I f=1j(7,w(i,\':19(\'+c+\')\')),1c=1V(1j(7,d[1],F),7);S.A(7.v[6],S.r(\'Q\')+7.D[1]);Z.A(7.v[6],Z.r(\'Q\')+7.D[1]);I g={},2h={},1r={},H=b.O;8(H==\'z\')H=7.R.O/7.R.j*c;G 8(H<10)H=f[0]/H;8(b.1W)b.1W(d[0],d[1],1c,H);g[7.v[4]]=-f[0];2h[7.v[6]]=S.r(\'Q\');1r[7.v[6]]=1a.r(\'Q\')+7.D[3];Z.A(7.v[6],Z.r(\'Q\')+7.D[1]);S.1s().1d(2h,{O:H,P:b.P});1a.1s().1d(1r,{O:H,P:b.P});$1n.1s().1d(1c,{O:H,P:b.P});i.r(\'1t\',c).r(\'1u\',b).r(\'1X\',d[0]).r(\'1Y\',d[1]).r(\'1Z\',1c).1d(g,{O:H,P:b.P,2y:q(){8(i.r(\'1u\').20){i.r(\'1u\').20(i.r(\'1X\'),i.r(\'1Y\'),i.r(\'1Z\'))}8(u<7.j.B+i.r(\'1t\')){w(i,\':1U(\'+(u-1)+\')\').1F()}i.A(7.v[4],7.D[3]);I a=w(i,\':19(\'+i.r(\'1t\')+\')\').2e(i).1b(\':1q\');a.A(7.v[6],a.r(\'Q\'))}});i.t(\'1k\').t(\'N\',[\'\',H])}).15(\'1v\',q(e,a,b,c,d){8(i.1g(\':1R\'))s L;a=21(a,b,c,E,u,i);8(a==0)s L;8(9(d)!=\'14\')d=L;8(7.1h){8(a<u/2)i.t(\'x\',[d,a]);G i.t(\'y\',[d,u-a])}G{8(E==0||E>a)i.t(\'x\',[d,a]);G i.t(\'y\',[d,u-a])}}).15(\'2z\',q(e,a,b,c,d){8(9(a)==\'14\'&&9(a.1G)==\'11\')a=$(a);8(9(a)==\'16\')a=$(a);8(9(a)!=\'14\'||9(a.1G)==\'11\'||a.U==0){W(\'1f a 1S 14.\');s L}8(9(b)==\'11\'||b==\'2A\'){i.2i(a)}G{b=21(b,d,c,E,u,i);I f=w(i,\':1i(\'+b+\')\');8(f.U){8(b<=E)E+=a.U;f.30(a)}G{i.2i(a)}}u=w(i).U;1H(i,7);i.t(\'1k\',F)}).15(\'2B\',q(e,a,b,c){8(9(a)==\'11\'||a==\'2A\'){w(i,\':1q\').1F()}G{a=21(a,c,b,E,u,i);I d=w(i,\':1i(\'+a+\')\');8(d.U){8(a<E)E-=d.U;d.1F()}}u=w(i).U;1H(i,7);i.t(\'1k\',F)}).15(\'1k\',q(e,b){8(!7.M.X)s L;8(9(b)==\'V\'&&b){w(7.M.X).1F();2j(I a=0;a<2C.31(u/7.j.B);a++){7.M.X.2i(7.M.2a(a+1))}w(7.M.X).12(\'22\').1x(q(a){$(C).22(q(e){i.t(\'1v\',[a*7.j.B,0,F,7.M]);e.2k()})})}I c=(E==0)?0:2C.32((u-E)/7.j.B);w(7.M.X).2d(\'2D\').1b(\':1i(\'+c+\')\').1T(\'2D\')});8(7.2E){i.15(\'2F\',q(e,a,b,c,d){i.t(\'1v\',[a,b,c,d])})}};C.2G=q(){8(7.z.1I&&7.z.N){$1n.23(q(){i.t(\'18\')},q(){i.t(\'N\')})}8(7.y.J){7.y.J.22(q(e){i.t(\'y\');e.2k()});8(7.y.1I&&7.z.N){7.y.J.23(q(){i.t(\'18\')},q(){i.t(\'N\')})}8(!7.1h&&!7.1p){7.y.J.1T(\'1E\')}}8(7.x.J){7.x.J.22(q(e){i.t(\'x\');e.2k()});8(7.x.1I&&7.z.N){7.x.J.23(q(){i.t(\'18\')},q(){i.t(\'N\')})}}8(7.M.X){i.t(\'1k\',F);8(7.M.1I&&7.z.N){7.M.X.23(q(){i.t(\'18\')},q(){i.t(\'N\')})}}8(7.x.1e||7.y.1e){$(2H).2I(q(e){I k=e.2J;8(k==7.x.1e)i.t(\'x\');8(k==7.y.1e)i.t(\'y\')})}8(7.M.1M){$(2H).2I(q(e){I k=e.2J;8(k>=2K&&k<33){k=(k-2K)*7.j.B;8(k<=u){i.t(\'1v\',[k,0,F,7.M])}}})}8(7.z.N){i.t(\'N\',[13,7.z.2b]);8($.Y.1B&&7.z.1B){i.1B(\'18\',\'N\')}}8(7.j.1L!=0){i.t(\'1v\',[0,7.j.1L,F,{O:0}])}};C.34=q(){i.A(i.r(\'2t\')).12(\'18\').12(\'N\').12(\'y\').12(\'x\').12(\'2F\').12(\'1v\').12(\'2z\').12(\'2B\').12(\'1k\');$1n.35(i);s C};C.36=q(a,b){8(9(a)==\'11\')s 7;8(9(b)==\'11\')s 2L(\'7.\'+a);2L(\'7.\'+a+\' = b\');C.26(7);1H(i,7);s C};I i=$(C),$1n=$(C).3a(\'<3b 3c="3d" />\').2M(),7={},u=w(i).U,E=0,1Q=2w,13=\'x\';C.26(o);C.2s();C.2v();C.2G();1H(i,7);s C};$.Y.T.29=3e;$.Y.T.2n={1p:F,1h:F,13:\'17\',D:0,2E:F,j:{B:5},R:{O:$.Y.T.29,P:\'3f\',1I:L}};$.Y.T.2r=q(a){s\'<a 3g="#"><2N>\'+a+\'</2N></a>\'};q 2l(k){8(k==\'2q\')s 39;8(k==\'17\')s 37;8(k==\'2p\')s 38;8(k==\'3h\')s 3i;s-1};q 1A(a,b,c){8(9(b)!=\'V\')b=L;8(9(c)!=\'V\')c=L;8(9(a)==\'11\')a={};8(9(a)==\'16\'){I d=2l(a);8(d==-1)a=$(a);G a=d}8(b){8(9(a.1G)!=\'11\')a={X:a};8(9(a)==\'V\')a={1M:a};8(9(a.X)==\'16\')a.X=$(a.X)}G 8(c){8(9(a)==\'V\')a={N:a};8(9(a)==\'K\')a={1N:a}}G{8(9(a.1G)!=\'11\')a={J:a};8(9(a)==\'K\')a={1e:a};8(9(a.J)==\'16\')a.J=$(a.J);8(9(a.1e)==\'16\')a.1e=2l(a.1e)}s a};q w(a,f){8(9(f)!=\'16\')f=\'\';s $(\'> *:1o(.3j)\'+f,a)};q 2f(c,o,n){I a=w(c,\':19(\'+o.j.B+\')\'),2O=w(c,\':19(\'+(o.j.B+n)+\'):1U(\'+(n-1)+\')\');s[a,2O]};q 21(a,b,c,d,e,f){8(9(a)==\'16\'){8(1P(a))a=$(a);G a=1C(a)}8(9(a)==\'14\'){8(9(a.1G)==\'11\')a=$(a);a=w(f).3k(a);8(9(c)!=\'V\')c=L}G{8(9(c)!=\'V\')c=F}8(1P(a))a=0;G a=1C(a);8(1P(b))b=0;G b=1C(b);8(c){a+=d;8(a>=e)a-=e}a+=b;8(a>=e)a-=e;8(a<0)a+=e;s a};q 1j(o,a,b){8(9(b)!=\'V\')b=L;I c=o.v,1J=0,1w=0;8(b&&9(o[c[0]])==\'K\')1J+=o[c[0]];G 8(9(o.j[c[0]])==\'K\')1J+=o.j[c[0]]*a.U;G{a.1x(q(){1J+=$(C)[c[1]](F)})}8(b&&9(o[c[2]])==\'K\')1w+=o[c[2]];G 8(9(o.j[c[2]])==\'K\')1w+=o.j[c[2]];G{a.1x(q(){I m=$(C)[c[3]](F);8(1w<m)1w=m})}s[1J,1w]};q 1V(a,o){I b={};b[o.v[0]]=a[0]+o.D[1]+o.D[3];b[o.v[2]]=a[1]+o.D[0]+o.D[2];s b};q 1H(a,o){I b=a.2M(),$i=w(a),$l=$i.1b(\':1i(\'+(o.j.B-1)+\')\'),1g=1j(o,$i);b.A(1V(1j(o,$i.1b(\':19(\'+o.j.B+\')\'),F),o));$l.A(o.v[6],$l.r(\'Q\')+o.D[1]);a.A(o.v[0],1g[0]*2).A(o.v[2],1g[1]).A(o.v[5],o.D[0]).A(o.v[4],o.D[3])};q 2o(p){8(9(p)==\'K\')p=[p];G 8(9(p)==\'16\')p=p.2P(\'3l\').3m(\'\').2P(\' \');8(9(p)!=\'14\'){W(\'1f a 1S 3n 2j D.\');p=[0]}2j(i 3o p){p[i]=1C(p[i])}3p(p.U){24 0:s[0,0,0,0];24 1:s[p[0],p[0],p[0],p[0]];24 2:s[p[0],p[1],p[0],p[1]];24 3:s[p[0],p[1],p[2],p[1]];3q:s[p[0],p[1],p[2],p[3]]}};q W(m){8(9(m)==\'16\')m=\'T: \'+m;8(2m.25&&2m.25.W)2m.25.W(m);G 3r{25.W(m)}3s(3t){}};$.Y.3u=q(o){C.T(o)}})(3v);', 62, 218, '|||||||opts|if|typeof||||||||||items|||||||function|data|return|trigger|totalItems|dimentions|getItems|next|prev|auto|css|visible|this|padding|firstItem|true|else|a_dur|var|button|number|false|pagination|play|duration|easing|cfs_origCssMargin|scroll|l_old|carouFredSel|length|boolean|log|container|fn|l_new||undefined|unbind|direction|object|bind|string|left|pause|lt|l_cur|filter|w_siz|animate|key|Not|is|circular|nth|getSizes|updatePageStatus|width|height|wrp|not|infinite|last|a_cur|stop|cfs_numItems|cfs_slideObj|slideTo|s2|each|extend|minimum|getNaviObject|nap|parseInt|scrolling|disabled|remove|jquery|setSizes|pauseOnHover|s1|top|start|keys|pauseDuration|position|isNaN|autoInterval|animated|valid|addClass|gt|mapWrapperSizes|onBefore|cfs_oldItems|cfs_newItems|cfs_wrapSize|onAfter|getItemIndex|click|hover|case|console|init|outerWidth|outerHeight|defaultDuration|anchorBuilder|delay|enough|removeClass|appendTo|getCurrentItems|a_new|a_old|append|for|preventDefault|getKeyCode|window|defaults|getPadding|up|right|pageAnchorBuilder|build|cfs_origCss|hide|bind_events|null|clone|complete|insertItem|end|removeItem|Math|selected|useScrollTo|scrollTo|bind_buttons|document|keyup|keyCode|49|eval|parent|span|ni|split|marginRight|marginBottom|2500|relative|overflow|hidden|absolute|clearTimeout|setTimeout|prependTo|before|ceil|round|58|destroy|replaceWith|configuration||||wrap|div|class|caroufredsel_wrapper|500|swing|href|down|40|caroufredsel_spacer|index|px|join|value|in|switch|default|try|catch|err|caroufredsel|jQuery'.split('|'), 0, {}))


$(function () {

    $("#foo4").carouFredSel({
        items: 1,
        direction: "left",
        auto: {
            pauseOnHover: true
        },
        scroll: {
            duration: 1000
        },
        pagination: "#foo4_pag"
    });

    $("#foo2").carouFredSel({
        items: 1,
        direction: "left",
        auto: {
            pauseOnHover: true
        },
        scroll: {
            duration: 1000
        },
        pagination: {
            container: "#foo2_pag",
            anchorBuilder: function (nr) {
                return "<a href='#'><span><p>" + $(".slide h4")[nr - 1].innerHTML + "</p></span></a>";
                }
        }
    });


    // select #flowplanes and make it scrollable. use circular and navigator plugins
    $("#flowpanes").scrollable({ circular: true, mousewheel: false }).navigator({

        // select #flowtabs to be used as navigator
        navi: "#flowtabs",

        // select A tags inside the navigator to work as items (not direct children)
        naviItem: 'a',

        // assign "current" class name for the active A tag inside navigator
        activeClass: 'current',

        // make browser's back button work
        history: true

    });

    $('.css-scrollbar').scrollbar();

});


$(document).ready(function () {
    $(".dropdown img.flag").addClass("flagvisibility");

    $(".dropdown dt a").click(function () {
        $(".dropdown dd ul").toggle();
    });

    $(".dropdown dd ul li a").click(function () {
        var text = $(this).html();
        $(".dropdown dt a span").html(text);
        $(".dropdown dd ul").hide();
        $("#result").html("Selected value is: " + getSelectedValue("blogdd"));
    });

    function getSelectedValue(id) {
        return $("#" + id).find("dt a span.value").html();
    }

    $(document).bind('click', function (e) {
        var $clicked = $(e.target);
        if (!$clicked.parents().hasClass("dropdown"))
            $(".dropdown dd ul").hide();
    });


    $("#flagSwitcher").click(function () {
        $(".dropdown img.flag").toggleClass("flagvisibility");
    });

    $("#foo4").css({ visibility: "visible" });
});